﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Normal;

namespace TestWinformHelper
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                DAO<Contact> dao = null;
                try
                {
                    dao = new DAO<Contact>("data source=.;initial catalog=AdventureWorks;user id=adworks;password=adworks", DatabaseType.MsSQL);
                }
                catch
                {
                }
                try
                {
                    dao = new DAO<Contact>(@"data source=.\SQLEXPRESS;initial catalog=AdventureWorks;user id=adworks;password=adworks", DatabaseType.MsSQL);
                }
                catch
                {
                }
                Contact contact = dao.FindById(new Object[] { 157, "teste@uol.com.br" });

                if (contact != null)
                {
                    Normal.WinFormHelper<Contact> Helper = new WinFormHelper<Contact>(System.Globalization.CultureInfo.CurrentCulture);
                    Helper.FillForm(this, contact);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}